<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<!--<botton onclick="perform_task">dsdsdsd</botton>-->
</body>

<script>
    function f1(msg) {
        console.log(msg);
    }

    function f2(msg) {
        console.log(msg);
    }

    task_name_queue = [];
    task_parameter_queue = [];
    task_name_queue.push("f1");
    task_name_queue.push("f2");
    task_parameter_queue.push("first");
    task_parameter_queue.push("second");

    const s = new Date().getSeconds();

    function perform_task() {
        console.log("entering!")

        // while(true) {
        //     if(new Date().getSeconds() - s >= 10) {
        //         console.log("Good, looped for 2 seconds");
        //         break;
        //     }
        // }
        console.log(task_name_queue.length)
        while (task_name_queue.length > 0) {
            let task_name = task_name_queue.shift()
            let task_parameter = task_parameter_queue.shift();
            eval(task_name + "('" + task_parameter + "')");
        }
    }





</script>
</html>